package cn.tt.tuantuanerp.tuantuanerp.search.controller;

import cn.tt.tuantuanerp.tuantuanerp.comment.web.JsonResult;
import cn.tt.tuantuanerp.tuantuanerp.search.service.ISkuSearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/search/skus")
public class SkuSearchController {
    @Autowired
    private ISkuSearchService skuSearchService;

    @GetMapping("/{name}")
    public JsonResult selectByName(@PathVariable String name){
        System.out.println(name==null);
        log.debug("接受到搜索sku请求,关键词:{}",name);
        return JsonResult.ok(skuSearchService.querySkuBySkuNameMatches(name));
    }

}
